package com.jinan;

import com.jinan.config.AppConfig;
import com.jinan.service.MailService;
import com.jinan.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestMain {
    public static void main(String[] args) {
        // 手动装配
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("application.xml");
//        MailService mailService = applicationContext.getBean(MailService.class);
//        mailService.test();
        String id = applicationContext.getId();
        System.out.println("id:"+id);
//
//        UserService userService = applicationContext.getBean(UserService.class);
//        userService.test();


        // 自动装配
//        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class);
//        UserService userService = applicationContext.getBean(UserService.class);
//        userService.test();

    }
}
